import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] arr = new int [n];
            for (int i = 0; i < n ; i++) {
                arr[i] = in.nextInt();
            }
            Arrays.sort(arr);
            int count = cal(arr, n, 0, 0, 1);
            System.out.print(count);
        }
    }

    public static int cal(int[] a, int n, int pos, int sum, int mul) {
        int count = 0;
        for (int i = pos; i < n; i++) {
            sum += a[i];
            mul *= a[i];
            if (sum > mul) {
                count = count + 1 + cal(a, n, i + 1, sum, mul);
            } else if (a[i] == 1) {
                count = count + cal(a, n, i + 1, sum, mul);
            } else {
                break;
            }
            sum -= a[i];
            mul /= a[i];
            while (i < n - 1 && a[i] == a[i + 1]) {
                i++;
            }
        }
        return count;
    }
}
